#include "EventCatcher.h"

EventCatcher::EventCatcher(IrrlichtDevice *device) {
	// Self-explanatory
	m_device = device;
}

EventCatcher::~EventCatcher() {
	// Hello...?
}

bool EventCatcher::OnEvent(const SEvent& event)
{
	// Create an iterator to traverse the vector
	std::vector<boost::shared_ptr<EventHandler> >::iterator eventIterator;
	
	// Iterate over the entire vector
	for(eventIterator = m_eventHandlers.begin();
	eventIterator != m_eventHandlers.end();
	eventIterator++) {
		// Does the handler take care of this event?
		if((*eventIterator)->OnEvent(event))
			return true;
		// If we reach here, it did not. Repeat.
	}
	
	// Nothing handled the event! Return false.
	return false;
}
